<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admuppathliste.php,v $ 
 * $Date: 2006/04/25 06:40:58 $ 
 * $Revision: 1.3 $ 
 * 
 * ********* CVS HEADER ********* 
 */
require_once("module/INI/readinifile.php");
if($action=="process"){
	$rportalparams->set_key("RPORTAL","upload.ftp.path",$ftp);
}
$message="";
require_once("module/TPLN/TPLN.php"); 
$TPLN = new TPLN; 
$TPLN->Open($op_basepath."tpl/admuppathliste.html"); 
$TPLN->IncludeFile("header","environnement/$session[environnement]/header.php"); 
$TPLN->IncludeFile("footer","environnement/$session[environnement]/footer.php");

require_once(get_path_module("admin"));
$pc = new panneau_controle();
$pc->calculRubriqueParFonction($op);
$TPLN->Parse("panneau_controle",$pc->retourneEntete());

$query="SELECT p.*,groupe_upload.nom AS droit_nom,downgroupe.nom AS download FROM hierarchie,rportal_upload_path AS p LEFT OUTER JOIN groupe AS groupe_upload ON p.droit=groupe_upload.id LEFT OUTER JOIN groupe AS downgroupe ON p.droit_download=downgroupe.id WHERE hierarchie.id_groupe_dessus='$session[id_groupe]' AND ((p.droit='-1' AND hierarchie.id_groupe='$session[id_groupe]') OR p.droit=hierarchie.id_groupe) ORDER BY p.path";
//$message=$query;
$result=rportalrequete($query) or die ("ERREUR<br>$query");
if(rportalnbresult($result)==0){
    $TPLN->EraseBloc("bloc1");
    $message="Pas encore de path";
}else{
    $class="liste_impaire"; 
    while($row=rportalligne($result)) {
            $TPLN->Parse("bloc1.nom",$row['nom']); 
            if($row['droit']==-1)
                $TPLN->Parse("bloc1.droit","Upload Interdit");
            else
                $TPLN->Parse("bloc1.droit",$row['droit_nom']);
            if($row['droit_download']==-1) 
                $TPLN->Parse("bloc1.download","Telechargement Interdit");
            else
                $TPLN->Parse("bloc1.download",$row['download']);
            $TPLN->Parse("bloc1.path",$row['path']); 
            $TPLN->Parse("bloc1.script",$row['script']);
            $TPLN->Parse("bloc1.param",$row['param']);
            if(trim($row['filetype'])=='') $TPLN->Parse("bloc1.type","Tous"); 
            else $TPLN->Parse("bloc1.type",$row['filetype']); 
            $TPLN->Parse("bloc1.modif","?op=admuppathadd&pathid=".$row['id']);
            $TPLN->Parse("bloc1.supp","?op=admuppathsupp&pathid=".$row['id']);
            $TPLN->Parse("bloc1.classe",$class);
            if($class!="liste_impaire") 
            { 
                $class="liste_impaire"; 
            }else{ 
                $class="liste_paire"; 
            } 
    
            $TPLN->Loop("bloc1"); 
    } 
}
$TPLN->Parse("add","?op=admuppathadd&pathid=-1");
$TPLN->Parse("ftp",$rportalparams->get_value("RPORTAL","upload.ftp.path"));
$TPLN->Parse("message",$message);
$TPLN->Write(); 
?>